//
//  MemberCenterViewController.m
//  NewProject
//
//  Created by Livespro on 2016/11/26.
//  Copyright © 2016年 FZ. All rights reserved.
//

#import "MemberCenterViewController.h"

#import "QsbkMainViewController.h"

#import "CommonWebViewController.h"

#define ChatListArray @[@"糗事百科"]

@interface MemberCenterViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong)  UITableView *readList;

@end

@implementation MemberCenterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (void)staticViewsWithoutNib{
    
    [self.view addSubview:self.readList];
    
}

#pragma mark - lazyLoad

-(UITableView *)readList{
    if (!_readList) {
        _readList=[[UITableView alloc]initWithFrame:CGRectMake(0, 64, kScreenWidth, kScreenHeight - 64 - 49) style:UITableViewStyleGrouped];
        
        _readList.delegate = self;
        _readList.dataSource = self;
        _readList.showsHorizontalScrollIndicator = NO;
        _readList.showsVerticalScrollIndicator  = NO;
        _readList.separatorStyle = UITableViewCellSeparatorStyleNone;
        _readList.backgroundColor=pageColor;
        
    }
    return _readList;
}

#pragma mark - TableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return ChatListArray.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;{
    
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;{
    
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([self class])];
    
    if (!cell)
    {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass([self class])];
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        
        cell.textLabel.font = [UIFont systemFontOfSize:14];
        cell.detailTextLabel.font = [UIFont systemFontOfSize:12];
        cell.textLabel.textColor = [UIColor colorWithHexString:@"333333"];
        cell.detailTextLabel.textColor = [UIColor colorWithHexString:@"999999"];
        cell.imageView.frame = CGRectMake(10, 12, 20, 20);
    }
    
    cell.textLabel.text = ChatListArray[indexPath.row];
    cell.detailTextLabel.text = [NSString stringWithFormat:@"%@让生活更好玩",ChatListArray[indexPath.row]];
    cell.imageView.image = [UIImage imageNamed:ChatListArray[indexPath.row]];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NSString *name_Stand = ChatListArray[indexPath.row];
    
    if ([name_Stand isEqualToString:@"糗事百科"]) {
        
//        QsbkMainViewController *qsbkMainVC = [[QsbkMainViewController alloc]init];
        CommonWebViewController *qsbkMainVC = [[CommonWebViewController alloc]init];
        qsbkMainVC.urlString = @"https://www.baidu.com";
        qsbkMainVC.title = @"";
        [self.navigationController pushViewController:qsbkMainVC animated:YES];
        
    } else {
        
    }
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 10;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    return 0.01f;
}

@end

